﻿using Frame.Core.IServices.Admin;
using Frame.Core.Models;
using Frame.Core.Repository;
using System.Threading.Tasks;

namespace Frame.Core.Services.Admin
{
    public class CodeService : BaseService<Titles>, ITitleService
    {

        IRepositoryBase<Titles> _dal;
        IRepositoryBase<TitleUsers> _titleUserRepository;
        public CodeService(IRepositoryBase<Titles> dal,IRepositoryBase<TitleUsers> titleUserRepository)
        {
            this._dal = dal;
            base.BaseDal = dal;
            _titleUserRepository = titleUserRepository;
        }
        public async Task<long> GetTitleUsersCountById(int titleID)
        {
            return await _titleUserRepository.Select.Where(a => a.TitleID == titleID).CountAsync();
        }
    }
}
